package org.jivesoftware.smackx.workgroup.packet;

import java.io.PrintStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import org.jivesoftware.smack.packet.PacketExtension;
import org.jivesoftware.smack.provider.PacketExtensionProvider;
import org.jivesoftware.smackx.workgroup.QueueUser;
import org.xmlpull.v1.XmlPullParser;

public class QueueDetails
  implements PacketExtension
{
  private static final SimpleDateFormat DATE_FORMATTER = new SimpleDateFormat("yyyyMMdd'T'HH:mm:ss");
  public static final String ELEMENT_NAME = "notify-queue-details";
  public static final String NAMESPACE = "http://jabber.org/protocol/workgroup";
  private Set<QueueUser> users = new HashSet();

  private void addUser(QueueUser paramQueueUser)
  {
    synchronized (this.users)
    {
      this.users.add(paramQueueUser);
      return;
    }
  }

  public String getElementName()
  {
    return "notify-queue-details";
  }

  public String getNamespace()
  {
    return "http://jabber.org/protocol/workgroup";
  }

  public int getUserCount()
  {
    return this.users.size();
  }

  public Set<QueueUser> getUsers()
  {
    synchronized (this.users)
    {
      Set localSet2 = this.users;
      return localSet2;
    }
  }

  // ERROR //
  public String toXML()
  {
    // Byte code:
    //   0: new 69	java/lang/StringBuilder
    //   3: dup
    //   4: invokespecial 70	java/lang/StringBuilder:<init>	()V
    //   7: astore_1
    //   8: aload_1
    //   9: ldc 72
    //   11: invokevirtual 76	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   14: ldc 15
    //   16: invokevirtual 76	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   19: ldc 78
    //   21: invokevirtual 76	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   24: ldc 18
    //   26: invokevirtual 76	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   29: ldc 80
    //   31: invokevirtual 76	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   34: pop
    //   35: aload_0
    //   36: getfield 40	org/jivesoftware/smackx/workgroup/packet/QueueDetails:users	Ljava/util/Set;
    //   39: astore_3
    //   40: aload_3
    //   41: monitorenter
    //   42: aload_0
    //   43: getfield 40	org/jivesoftware/smackx/workgroup/packet/QueueDetails:users	Ljava/util/Set;
    //   46: invokeinterface 84 1 0
    //   51: astore 5
    //   53: aload 5
    //   55: invokeinterface 90 1 0
    //   60: ifne +27 -> 87
    //   63: aload_3
    //   64: monitorexit
    //   65: aload_1
    //   66: ldc 92
    //   68: invokevirtual 76	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   71: ldc 15
    //   73: invokevirtual 76	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   76: ldc 94
    //   78: invokevirtual 76	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   81: pop
    //   82: aload_1
    //   83: invokevirtual 97	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   86: areturn
    //   87: aload 5
    //   89: invokeinterface 101 1 0
    //   94: checkcast 103	org/jivesoftware/smackx/workgroup/QueueUser
    //   97: astore 6
    //   99: aload 6
    //   101: invokevirtual 106	org/jivesoftware/smackx/workgroup/QueueUser:getQueuePosition	()I
    //   104: istore 7
    //   106: aload 6
    //   108: invokevirtual 109	org/jivesoftware/smackx/workgroup/QueueUser:getEstimatedRemainingTime	()I
    //   111: istore 8
    //   113: aload 6
    //   115: invokevirtual 113	org/jivesoftware/smackx/workgroup/QueueUser:getQueueJoinTimestamp	()Ljava/util/Date;
    //   118: astore 9
    //   120: aload_1
    //   121: ldc 115
    //   123: invokevirtual 76	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   126: aload 6
    //   128: invokevirtual 118	org/jivesoftware/smackx/workgroup/QueueUser:getUserID	()Ljava/lang/String;
    //   131: invokevirtual 76	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   134: ldc 80
    //   136: invokevirtual 76	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   139: pop
    //   140: iload 7
    //   142: bipush 255
    //   144: if_icmpeq +20 -> 164
    //   147: aload_1
    //   148: ldc 120
    //   150: invokevirtual 76	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   153: iload 7
    //   155: invokevirtual 123	java/lang/StringBuilder:append	(I)Ljava/lang/StringBuilder;
    //   158: ldc 125
    //   160: invokevirtual 76	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   163: pop
    //   164: iload 8
    //   166: bipush 255
    //   168: if_icmpeq +20 -> 188
    //   171: aload_1
    //   172: ldc 127
    //   174: invokevirtual 76	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   177: iload 8
    //   179: invokevirtual 123	java/lang/StringBuilder:append	(I)Ljava/lang/StringBuilder;
    //   182: ldc 129
    //   184: invokevirtual 76	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   187: pop
    //   188: aload 9
    //   190: ifnull +30 -> 220
    //   193: aload_1
    //   194: ldc 131
    //   196: invokevirtual 76	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   199: pop
    //   200: aload_1
    //   201: getstatic 33	org/jivesoftware/smackx/workgroup/packet/QueueDetails:DATE_FORMATTER	Ljava/text/SimpleDateFormat;
    //   204: aload 9
    //   206: invokevirtual 135	java/text/SimpleDateFormat:format	(Ljava/util/Date;)Ljava/lang/String;
    //   209: invokevirtual 76	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   212: pop
    //   213: aload_1
    //   214: ldc 137
    //   216: invokevirtual 76	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   219: pop
    //   220: aload_1
    //   221: ldc 139
    //   223: invokevirtual 76	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   226: pop
    //   227: goto -174 -> 53
    //   230: astore 4
    //   232: aload_3
    //   233: monitorexit
    //   234: aload 4
    //   236: athrow
    //
    // Exception table:
    //   from	to	target	type
    //   42	65	230	finally
    //   87	234	230	finally
  }

  public static class Provider
  implements PacketExtensionProvider
  {
    public PacketExtension parseExtension(XmlPullParser paramXmlPullParser)
      throws Exception
    {
      int j;
      int k;
      Date localDate1;
      int l;
      QueueDetails localQueueDetails = new QueueDetails(null);
      int i = paramXmlPullParser.getEventType();
      if ((i == 3) || (!("notify-queue-details".equals(paramXmlPullParser.getName()))))
        return localQueueDetails;
      i = paramXmlPullParser.next();
      while (true)
      {
        if ((i != 2) || (!("user".equals(paramXmlPullParser.getName()))));
        j = -1;
        k = -1;
        localDate1 = null;
        String str = paramXmlPullParser.getAttributeValue("", "jid");
        l = paramXmlPullParser.next();
        if ((l != 3) || (!("user".equals(paramXmlPullParser.getName()))))
          break;
        QueueDetails.access$2(localQueueDetails, new QueueUser(str, j, k, localDate1));
        i = paramXmlPullParser.next();
      }
      if ("position".equals(paramXmlPullParser.getName()))
        j = Integer.parseInt(paramXmlPullParser.nextText());
      while (true)
      {
        do
          while (true)
          {
            while (true)
            {
              while (true)
                l = paramXmlPullParser.next();
              if (!("time".equals(paramXmlPullParser.getName())))
                break;
              k = Integer.parseInt(paramXmlPullParser.nextText());
            }
            if (!("join-time".equals(paramXmlPullParser.getName())))
              break;
            localDate1 = QueueDetails.access$1().parse(paramXmlPullParser.nextText());
          }
        while (!(paramXmlPullParser.getName().equals("waitTime")));
        Date localDate2 = QueueDetails.access$1().parse(paramXmlPullParser.nextText());
        System.out.println(localDate2);
      }
    }
  }
}